﻿using System;
using System.Collections.Generic;

namespace Com.Lancetinc.Evs.Reports.RadPdf;

internal class CompositeDisposableObject : IDisposable
{
    private readonly List<IDisposable> components = new();

    public void Dispose()
    {
        foreach (var component in components)
        {
            component.Dispose();
        }

        components.Clear();
    }

    public void Add(IDisposable component)
    {
        if (component != null)
        {
            components.Add(component);
        }
    }
}